I am trying to figure out a way to create a script that will remove backslashes that appear in front of open and close braces ({ }). I am trying to use another piece of code as a template, but can't figure out how to alter the code to do what I want. I know I'll need a while loop within the function, but I'm not sure how to set up this while loop. This is what I've come up with so far:
string removeBackslashBraces(string s) {
Buffer str = create;
str = s;
int len = length s;
int j, i=0;
Regexp openBrace = regexp("\\{");
Regexp closeBrace = regexp ("\\}");
while (search(openBrace, str, 0) || search(closeBrace, str, 0)) {
if (search(openBrace, str, 0)) {
for (j=len-1; j>=0; j--) {
if (s[j]=="{" && s[j-1]=="\\") {
i=j-1;
break;
}
}
s = str[0:i-1] str[i+1:];
} // end if
else if (search(closeBrace, str, 0)) {
for (j=len-1; j>=0; j--) {
if (s[j]=="}" && s[j-1]=="\\") {
i = j-1;
break;
}
}
}
s = str[0:i-1] str[i+1:length str];
str = s
}
return stringOf str;
}
Can someone please help me figure this function out?
Chris Christopher Cote - Thu Mar 21 09:41:12 EDT 2019 |
Re: Remove backslash before open and close braces I don't have both Internet and DOORS available at the same time, so I write this without testing.
Maybe that will get you over the hump. -Louie |